From d5e2f520131956f03984544747b04247a6ce8ac5 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Thu, 4 Nov 2004 18:01:49 +0000 Subject: [PATCH] Add some hints about GnomeColorPicker --> GtkColorButton migration. 2004-11-04 Matthias Clasen * gtk/gtk-docs.sgml: * gtk/migrating-GtkColorButton.sgml: Add some hints about GnomeColorPicker --> GtkColorButton migration. --- docs/reference/ChangeLog | 6 +++ docs/reference/gtk/gtk-docs.sgml | 5 +++ .../gtk/migrating-GtkColorButton.sgml | 45 +++++++++++++++++++ 3 files changed, 56 insertions(+) create mode 100644 docs/reference/gtk/migrating-GtkColorButton.sgml diff --git a/docs/reference/ChangeLog b/docs/reference/ChangeLog index 140431bbe4..0f6021ac63 100644 --- a/docs/reference/ChangeLog +++ b/docs/reference/ChangeLog @@ -1,5 +1,11 @@ 2004-11-04 Matthias Clasen + * gtk/gtk-docs.sgml: + * gtk/migrating-GtkColorButton.sgml: Add some hints about + GnomeColorPicker --> GtkColorButton migration. + + * gtk/migrating-GtkAboutDialog.sgml: Fix links. + * gtk/Makefile.am (content_files): Add new migration chapters. * gtk/tmpl/gtkaboutdialog.sgml: Markup fix. diff --git a/docs/reference/gtk/gtk-docs.sgml b/docs/reference/gtk/gtk-docs.sgml index a6dc046103..26740e088b 100644 --- a/docs/reference/gtk/gtk-docs.sgml +++ b/docs/reference/gtk/gtk-docs.sgml @@ -193,6 +193,7 @@ + @@ -564,6 +565,9 @@ that is, GUI components such as GtkButton or This part describes what you need to change in programs use older versions of GTK+ so that they can use the new features. + It also mentions how to convert applications using widgets + found in the libgnomeui library to use their counterparts + in GTK+. @@ -575,6 +579,7 @@ that is, GUI components such as GtkButton or >k-migrating-GtkComboBox; >k-migrating-GtkIconView; >k-migrating-GtkAboutDialog; + >k-migrating-GtkColorButton; diff --git a/docs/reference/gtk/migrating-GtkColorButton.sgml b/docs/reference/gtk/migrating-GtkColorButton.sgml new file mode 100644 index 0000000000..183b50d005 --- /dev/null +++ b/docs/reference/gtk/migrating-GtkColorButton.sgml @@ -0,0 +1,45 @@ + + + Migrating from GnomeColorPicker to GtkColorButton + + + Since version 2.6, GTK+ provides the GtkColorButton + widget as a replacement for the GnomeColorPicker widget in the libgnomeui library. + + + + Porting an application from GnomeColorPicker to GtkColorButton + is very simple. GtkColorButton doesn't support dithering + (since it is rarely needed on modern hardware), and it doesn't have setters and getters to set the + color from floating point or integer components. So instead of + + guint red, green, blue, alpha; + /* ... */ + gnome_color_picker_set_i8 (color_picker, red, green, blue, alpha); + + you have to write + + GdkColor color; + + color.red = red << 8; + color.green = green << 8; + color.blue = blue << 8; + gtk_color_button_set_color (color_picker, &color); + gtk_color_button_set_alpha (color_picker, alpha << 8); + + and similarly for the setters taking other number formats. For gnome_color_picker_set_i16() no conversion + is needed, for gome_color_picker_set_d(), you need to convert the color components like this: + + color.red = (guint16) (red * 65535.0 + 0.5); + color.green = (guint16) (green * 65535.0 + 0.5); + color.blue = (guint16) (blue * 65535.0 + 0.5); + + + + + -- 2.30.2